package com.ssfGame.puremvc.view.application
{
	import com.ssfGame.puremvc.StaticConst;
	import com.ssfGame.puremvc.view.vc.APILayerVC;
	
	import flash.display.DisplayObject;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	public class APILayerMediator extends Mediator
	{
		public static const NAME:String="APILayerMediator";
		public function APILayerMediator(mediatorName:String=null, viewComponent:Object=null)
		{
			super(mediatorName, viewComponent);
		}
		override public function listNotificationInterests():Array{
			return [
				StaticConst.N_M_API_LAYER_ADD
			]
		}
		override public function handleNotification(notification:INotification):void{
			var disObj:DisplayObject=notification.getBody() as DisplayObject
			switch(notification.getName()){
				case StaticConst.N_M_API_LAYER_ADD:
					if(!apiLayer.contains(disObj)){
						apiLayer.addChild(disObj);
					}
					break
			}
		}
		public function get apiLayer():APILayerVC{
			return viewComponent as APILayerVC;
		}
	}
}